function [f, g, h]= L_sigma_2(x, model, n)

x=x';

term1 = -sum((x)./(2*model.sigma_02.^2));
term2 = (1/2)*sum(log(2*pi*x));
term3 = -(model.r2/model.zeta_2(n))*sum(exp(model.alpha_2(n,:)+x/2));

f     = -(term1+term2+term3);


if(nargout>1)
   
 term11 = -1./(2*model.sigma_02.^2);
 term12 = (1./(2*x));
 term13 = -(model.r2/(2*model.zeta_2(n)))*exp(model.alpha_2(n,:)+x/2);

 g      = -(term11+term12+term13);
 
 
  if(nargout>2)
    
   term21 = -(1./(2*x.^2));
   term22 = -(model.r2/(4*model.zeta_2(n)))*exp(model.alpha_2(n,:)+x/2);
 
   h      = -diag(term21 + term22);
  end


end



end
